package lewiszlw.sso.server.component;

import cn.hutool.cache.CacheUtil;
import cn.hutool.cache.impl.TimedCache;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName: GlobalCache
 * @Decription: 此处填写类文件说明
 * @Author: IDai
 * @Date: 2021-06-29 09:41 星期二
 **/
@Configuration
public class GlobalCache {


    @Bean(name = "timedCache")
    public TimedCache<String,String> timedCache(){
        //创建缓存，默认4毫秒过期
        //实例化创建
        //TimedCache<String, String> timedCache = new TimedCache<String, String>(4);
        //启动定时任务，每5毫秒秒检查一次过期
        //timedCache.schedulePrune(DateUnit.SECOND.getMillis() * 3);
        return CacheUtil.newTimedCache(3000);
    }

}
